package com.mydesignpattern.beijing.responsibilitychain.middle;

import com.mydesignpattern.beijing.responsibilitychain.middle.impl.FaceFilter;
import com.mydesignpattern.beijing.responsibilitychain.middle.impl.HtmlFilter;
import com.mydesignpattern.beijing.responsibilitychain.middle.impl.SensitiveFilter;
import org.junit.jupiter.api.Test;

/**
 * 有请求跟返回的责任链测试
 */
public class ChainTest {

    @Test
    public void testChain(){
        FilterChain chain = new FilterChain()
                .addFilter(new FaceFilter())
                .addFilter(new HtmlFilter())
                .addFilter(new SensitiveFilter());


        MsgProcessor processor = new MsgProcessor();
        processor.setFilterChain(chain);

        processor.processor(new Request("<script>asdf</script>"),new Response("/haha"));
    }

}
